package com.qiang.test12;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class test2 {
    public static void main(String[] args) throws ParseException {
        Date date = new Date();
        System.out.println(date);
        System.out.println("==========");

        SimpleDateFormat pdf = new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss");
        String format = pdf.format(date);
        System.out.println(format);
        System.out.println("==========");

        String s = "2020年11月12日 12:34:56";
        Date parse = pdf.parse(s);
        System.out.println(parse);
        System.out.println("==========");

        long time = date.getTime();
        System.out.println(time);
        System.out.println("==========");
        int year = date.getYear();
        System.out.println(year);
        System.out.println("==========");


    }
}
